<%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2019/12/29
  Time: 8:59
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <link type="text/css" href="../layui/css/layui.css" rel="stylesheet">
    <script type="text/javascript" src="../layui/layui.js"></script>
<script type="text/javascript">
    layui.use(['layer','laydate', 'form',"table","jquery","upload"], function(){
        var laydate=layui.laydate
        var layer = layui.layer
        var form = layui.form;
        var table=layui.table
        var $=layui.jquery

        $.ajax({

        })


        //嵌套在指定容器中
        var ins1 = laydate.render({
            elem: '#test2'
            ,position: 'static'
            ,url: ''
            ,mark: {
                '2017-8-20': '预发' //如果为空字符，则默认显示数字+徽章
                ,'2017-8-21': '发布'
            }
            ,change: function(value, date){ //监听日期被切换
                //lay('#testView').html(value);
                console.log("000")
                layer.open({
                    type: 1,
                    content: $('#addform')
                })
            }
            ,done: function(value, date){



            if(date.year === 2020 && date.month === 1 && date.date === 18){ //点击2017年8月15日，弹出提示语
                ins1.hint('中国人民抗日战争胜利72周年');
            }
        }
        });
        form.on('submit(submitFilter)', function(data){
            //console.log(data.field) //当前容器的全部表单字段，名值对形式：{name: value}
            $.ajax({
                url:"${pageContext.request.contextPath}/insertSchedule",
                data:data.field,
                success:function (data) {
                    if (data.isAdd) {
                        //关闭弹出框
                        layer.closeAll()
                        //重载table
                        table.reload('schedule');
                    }else {
                        layer.open({
                            content:"输入有误,请重新输入"
                        });
                    }
                }

            })
            return false; //阻止表单跳转。如果需要表单跳转，去掉这段即可。
        });
        /*监听添加工具栏======end*/

    })

</script>
</head>
<body>

<%--<span id="testView"></span>--%>
<div id="test2"></div>


<!--//添加表单-->
<form class="layui-form" style="display: none;" id="addform" lay-filter="formFilter"> <!-- 提示：如果你不想用form，你可以换成div等任何一个普通元素 -->
    <div class="layui-form-item">
        <label class="layui-form-label">主题:</label>
        <div class="layui-inline">
            <input type="text" name="name" lay-verify="required" placeholder="请输入便签标题"  class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">时间段:</label>
        <div class="layui-inline">
            <input type="date" name="datestart" lay-verify="required"   class="layui-input">--
            <input type="date" name="dateend" lay-verify="required"   class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">类型</label>
        <div class="layui-inline">
            <input type="radio" name="type" value="0" title="工作事务">
            <input type="radio" name="type" value="1" title="个人事务" checked>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">地点:</label>
        <div class="layui-inline">
            <input type="text" name="location" lay-verify="required" placeholder="请输入便签标题"  class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">预约他人</label>
        <div class="layui-inline">
            <select name="interest" lay-filter="userId">
                <option value="0">写作</option>
                <option value="1">阅读</option>
            </select>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">内容:</label>
        <div class="layui-inline">
            <textarea name="content" placeholder="请输入内容" class="layui-textarea"></textarea>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">是否公开:</label>
        <div class="layui-inline">
            <input type="radio" name="isOpen" value="0" title="是">
            <input type="radio" name="isOpen" value="1" title="否" checked>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">部门日程:</label>
        <div class="layui-inline">
            <input type="radio" name="isDept" value="0" title="是">
            <input type="radio" name="isDept" value="1" title="否" checked>
        </div>
        (如果为部门领导身份)
    </div>
    <div class="layui-form-item">
        <div class="layui-input-block">
            <button class="layui-btn" lay-submit lay-filter="submitFilter">立即提交</button>
            <button type="reset" class="layui-btn layui-btn-primary">重置</button>
        </div>
    </div>
    <!-- 更多表单结构排版请移步文档左侧【页面元素-表单】一项阅览 -->
</form>
</body>
</html>
